package com.itheima;

import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-06 09:20
 * @description
 */
public class Test01 {
    public static void main(String[] args) {
        //创建一个spring的容器对象

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");


        //获取service对象 看一看这个对象是否包含了 dao dao是否包含了datasource

        //根据类型获取 你可以根据真正对象类型获取  但一般面向接口获取
        UserService userService = context.getBean(UserService.class);

        System.out.println("获取到userService:"+userService);

        userService.login("zhangsan","12345");
    }
}
